package com.woniu.bh.backstage.controller;

import com.woniu.bh.backstage.client.CustomerClient;
import com.woniu.bh.backstage.param.ConditionedqueryParams;
import com.woniu.bh.backstage.param.FreezeCustomerParam;
import com.woniu.bh.common.core.dto.ResultDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;


/**
 * @version: V1.0
 * @author: Xbao
 * @className: CustomerManager
 * @packageName: com.woniu.bh.backstage.controller
 * @description:
 * @data: 2020-10-19 19:16
 */
@RestController
@RequestMapping("customer")
@Slf4j
@Api(tags = "用户管理")
public class CustomerController {

    @Autowired
    private CustomerClient customerClient;



    @PostMapping("/conditionedquery")
    @ApiOperation(value = "根据条件查询会员")
    public ResultDto conditionedquery(@RequestBody ConditionedqueryParams conditionedqueryParams){
        System.out.println("后台"+conditionedqueryParams.toString());
        return customerClient.conditionedquery(conditionedqueryParams);
    }

    @ApiOperation(value = "冻结/解冻用户")
    @PostMapping("/freeze")
    public ResultDto freeze(@RequestBody FreezeCustomerParam freezeCustomerParam){
        return customerClient.freeze(freezeCustomerParam);
    }

    @ApiOperation(value = "冻结/解冻用户")
    @PostMapping("/uploadHeadImg")
    public ResultDto uploadHeadImg(@RequestParam("file") MultipartFile file){
        return customerClient.uploadHeadImg(file);
    }
}
